<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="EmployeeCreateDlg" widgetVar="EmployeeCreateDialog" modal="true" resizable="false" appendToBody="true" header="#{bundle.CreateEmployeeTitle}">

            <h:form id="EmployeeCreateForm">

                <h:panelGroup id="display">
                    <p:panelGrid columns="2" rendered="#{employeeController.selected != null}">

                        <p:outputLabel value="#{bundle.CreateEmployeeLabel_fullName}" for="fullName" />
                        <p:inputText id="fullName" value="#{employeeController.selected.fullName}" title="#{bundle.CreateEmployeeTitle_fullName}" required="true" requiredMessage="#{bundle.CreateEmployeeRequiredMessage_fullName}"/>

                        <p:outputLabel value="#{bundle.CreateEmployeeLabel_userid}" for="userid" />
                        <p:selectOneMenu id="userid" value="#{employeeController.selected.userid}" required="true" requiredMessage="#{bundle.EditEmployeeRequiredMessage_userid}">
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{userController.items}"
                                           var="useridItem"
                                           itemValue="#{useridItem}"
                                           itemLabel="#{useridItem.id.toString()}"
                                           />
                            <f:converter binding="#{userConverter}"/>
                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{employeeController.saveNew}" value="#{bundle.Save}" update="display,:EmployeeListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,EmployeeCreateDialog);"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="EmployeeCreateDialog.hide()"/>
                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
